﻿using Magicodes.Pay.WeChat.Builder;
using Magicodes.Pay.WeChat.Config;
using Magicodes.WeChat.MiniProgram.Builder;
using Magicodes.WeChat.MiniProgram.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CarterWechatServer.WebApi.App_Start
{
    /// <summary>
    /// 微信小程序授权
    /// </summary>
    public class WechatConfig
    {
        public static void Register()
        {
            MiniProgramSDKBuilder.Create()
                .RegisterGetKeyFunc(() => { return "wx173179f4648300f6"; })
                .RegisterGetConfigByKeyFunc((key) =>
                {
                    return new DefaultMiniProgramConfig()
                    {
                        MiniProgramAppId = "wx173179f4648300f6",
                        MiniProgramAppSecret = "459a2b614c15f47e20c573b23b1531a0"
                    };
                }).Build();
        
           //微信支付
           WeChatPayBuilder.Create()
              .RegisterGetPayConfigFunc(() =>
              {
                  return new DefaultWeChatPayConfig()
                  {
                      PayAppId = "wx620ed498b15b2958",
                      MchId = "1528793811",
                      TenPayKey = "CHTDk2HDEI23nDB45sSNA1234DBShde4",
                      PayNotifyUrl = "http://thinger.cn/api/PayNotify"
                  };
              })
              .Build();
        }
    }
}